package com.bifang.common.constant.enums.common;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统级权限
 *
 * @author chenzh
 * @date 2018-08-12
 */
public enum SysPermissionEnum {
    superadmin("SUPERADMIN", "超级管理员"),
    allscene("ALLSCENE", "所有菜单可见"),
    allfunction("ALLFUNCTION", "可操作所有功能"),
    allAudit("ALLAudit", "可操作所有审核"),
    allorg("ALLORG", "所有区域（组织）权限"),
    allflownode("ALLFLOWNODE", "所有流程节点权限");
    // allquery("ALLQUERY","可操作所有查询"),
    // alledit("ALLEDIT","可操作所有编辑包括增删改"),
    // allinsert("ALLINSERT","可操作所有新增"),
    // allupdate("ALLUPDATE","可操作所有修改"),
    // alldelete("ALLDELETE","可操作所有删除"),
    // imp("IMP","所有数据导入"),
    // exp("EXP","所有数据导出"),
    // print("PRINT","打印");
    // alluser("ALLUSER","所有用户可见"),
    // createuser("CREATEUSER","创建用户"),
    // updateuser("UPDATEUSER","修改用户 不包括修改密码"),
    // resetpassword("RESETUSER","重置密码"),
    // userauthorization("USERAUTHORIZATION","用户授权"),
    // deleteuser("DELETEUSER","删除用户"),
    // kickoutuser("KICKOUTUSER","踢出用户"),
    // createrole("CREATEROLE","创建角色"),
    // updaterole("UPDATEROLE","修改角色"),
    // deleterole("DELETEROLE","删除角色"),
    // roleauthorization("ROLEAUTHORIZATION","角色授权");

    private String type;
    private String text;

    SysPermissionEnum(String type, String text) {
        this.type = type;
        this.text = text;
    }

    public String getType() {
        return this.type;
    }

    public String getText() {
        return this.text;
    }

    public static SysPermissionEnum getByType(String type) {
        for (SysPermissionEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        return null;
    }

    public static List<String> getTypes() {
        List<String> types = new ArrayList<>();
        for (SysPermissionEnum typeEnum : values()) {
            types.add(typeEnum.getType());
        }
        return types;
    }
}
